package com.yanqu.road.logic.activity.foxcard.game.spell;

import com.yanqu.road.logic.activity.foxcard.game.FoxCardGameLogic;
import com.yanqu.road.logic.activity.foxcard.game.eFoxCardTriggerType;

import java.math.BigDecimal;

/**
 * 金币翻x倍
 * 倍率|增加上限
 */
public class FoxCardSpellUse4 extends FoxCardSpellUseBase {
    @Override
    protected boolean spellUse(FoxCardGameLogic gameLogic) {
        int rate = spellConfig.getParamList().get(0);
        int addLimit = spellConfig.getParamList().get(1);

        int goldHave = gameLogic.getGameData().getGold();
        int goldAdd = BigDecimal.valueOf(goldHave).multiply(BigDecimal.valueOf(rate).divide(BigDecimal.valueOf(1000))).intValue();
        if (goldAdd > addLimit) {
            goldAdd = addLimit;
        }

        gameLogic.goldChange(goldAdd, null, null, eFoxCardTriggerType.REMOVE);
        return true;
    }
}
